result->fs.type = FS_AN1W;
result->fs.copy = Copy_AN1_Waypoint;
result->fs.destroy = Destroy_AN1_Waypoint;
+ result->fs.convert = NULL;
return result;
}
result->fs.type = FS_AN1V;
result->fs.copy = Copy_AN1_Vertex;
result->fs.destroy = Destroy_AN1_Vertex;
+ result->fs.convert = NULL;
return result;
}
result->fs.type = FS_AN1L;
result->fs.copy = Copy_AN1_Line;
result->fs.destroy = Destroy_AN1_Line;
+ result->fs.convert = NULL;
return result;
}
cet_convert_waypt(const waypoint *wpt)
{
waypoint *w = (waypoint *)wpt;
+ format_specific_data *fs;
if ((cet_output == 0) && (w->wpt_flags.cet_converted != 0)) return;
w->notes = cet_convert_string(wpt->notes);
w->url = cet_convert_string(wpt->url);
w->url_link_text = cet_convert_string(wpt->url_link_text);
+
+ fs = wpt->fs;
+ while (fs != NULL)
+ {
+ if (fs->convert != NULL)
+ fs->convert(fs);
+ fs = fs->next;
+ }
}
/* cet_convert_route_hdr: internal used within cet_convert_strings process */
{
char *cs_name_from, *cs_name_to;
-// printf("cet_convert_strings: enter\n"); fflush(stdout);
-
converter = NULL;
if ((source == NULL) || (source == &cet_cs_vec_utf8))
waypt_disp_all(cet_convert_waypt);
route_disp_all(cet_convert_route_hdr, cet_convert_route_tlr, cet_convert_waypt);
track_disp_all(cet_convert_route_hdr, cet_convert_route_tlr, cet_convert_waypt);
-
+
cet_output = 0;
if (global_opts.debug_level > 0)
int cet_vfprintf(FILE *stream, const cet_cs_vec_t *src_vec, const char *fmt, va_list args);
int cet_fprintf(FILE *stream, const cet_cs_vec_t *src_vec, const char *fmt, ...);
+/* cet_convert_string: !!! ONLY VALID WITHIN 'cet_convert_strings' process !!! */
+char *cet_convert_string(char *str);
+
/* gpsbabel extensions */
void cet_convert_init(const char *cs_name, const int force);
typedef void (*fs_destroy)(void *);
typedef void (*fs_copy)(void **, void *);
+typedef void (*fs_convert)(void *);
+
typedef struct format_specific_data {
long type;
struct format_specific_data *next;
fs_destroy destroy;
fs_copy copy;
+ fs_convert convert;
} format_specific_data;
format_specific_data *fs_chain_copy( format_specific_data *source );
result->fs.type = FS_GMSD;
result->fs.copy = (fs_copy) garmin_fs_copy;
result->fs.destroy = garmin_fs_destroy;
+ result->fs.convert = NULL;
result->fs.next = NULL;
result->protocol = protocol;
fsdata->fs.type = FS_OZI;
fsdata->fs.copy = (fs_copy) ozi_copy_fsdata;
fsdata->fs.destroy = ozi_free_fsdata;
+ fsdata->fs.convert = NULL;
/* Provide defaults via command line defaults */
fsdata->fgcolor = color_to_bbggrr(wptfgcolor);
copy_xml_tag( &(res->child), src->child, res );
}
+static void
+convert_xml_tag( xml_tag *tag ) {
+ char **ap = NULL;
+
+ if (tag == NULL) return;
+
+ tag->cdata = cet_convert_string(tag->cdata);
+ tag->parentcdata = cet_convert_string(tag->parentcdata);
+
+ ap = tag->attributes;
+ while (*ap)
+ {
+ *ap = cet_convert_string(*ap);
+ ap++;
+ }
+ convert_xml_tag(tag->sibling);
+ convert_xml_tag(tag->child);
+}
+
fs_xml *fs_xml_alloc( long type );
void fs_xml_destroy( void *fs ) {
copy_xml_tag( &(((fs_xml *)(*copy))->tag), src->tag, NULL );
}
+void fs_xml_convert( void *fs ) {
+ fs_xml *xml = (fs_xml *)fs;
+ if ( xml ) {
+ convert_xml_tag( xml->tag );
+ }
+}
fs_xml *fs_xml_alloc( long type ) {
fs_xml *result = NULL;
result->fs.type = type;
result->fs.copy = fs_xml_copy;
result->fs.destroy = fs_xml_destroy;
+ result->fs.convert = fs_xml_convert;
return result;
}
-